{extend name="layout" /}
{block name="content"}
<header class="mui-bar mui-bar-nav header-card">
	<!-- <a class="mui-action-back mui-icon mui-icon-arrowthinleft mui-pull-left" href="javascript:" onclick="coco_close_window()"></a> -->
	<a href="javascript:;" class="mui-pull-right sharing" id="open-operation">
		<div class="tm-icon">
			<img src="{$images_path}more-icon.png" alt="" width="16" height="16" />
		</div>
	</a>
	<div class="header-card-con">
		<div class="header-card-con-item">
			<div class="uk-text-center">
				<div class="tm-label-no tm-font-white">
					<span class="tm-lgx-size">{$info.name}</span>
				</div>
			</div>
			<div class="tm-flex-row-lgm">
				<div class="main-content">
					<div class="client-operation-item uk-text-center">
						<ul class="uk-grid">
							<li class="uk-width-1-2">
								<a href="tel:{$info.phone}" class="operation-item href">
									<img src="{$images_path}phone-white.png" alt="" width="16" height="16" />
								</a>
							</li>
							<li class="uk-width-1-3">
								<a href="sms:{$info.phone}" class="operation-item href">
									<img src="{$images_path}weixin-white.png" alt="" width="16" height="16" />
								</a>
							</li>
							<!-- <li class="uk-width-1-3">
								<a href="mailto:{info.email}" class="operation-item">
									<img src="{$images_path}mail.png" alt="" width="16" height="16" />
								</a>
							</li> -->
						</ul>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="tm-label-md tm-bg-white tm-border-bottom">
		<div class="main-content">
			<div class="main-tab">
				<div id="segmentedControl" class="mui-segmented-control mui-segmented-control-itme2">
					<a class="mui-control-item tm-icon-btn mui-active" href="#item100">
						<div class="tm-label-item">
							<div class="tm-label">
								详细资料
							</div>
						</div>
					</a>
					<a class="mui-control-item tm-icon-btn" href="#item200">
						<div class="tm-label-item">
							<div class="tm-label">
								成交订单
							</div>
						</div>
					</a>
					<a class="mui-control-item tm-icon-btn" href="#item300">
						<div class="tm-label-item">
							<div class="tm-label">
								所属经纪人
							</div>
						</div>
					</a>
				</div>
			</div>
		</div>
	</div>
</header>
<div class="tm-footer">
	<div class="tm-flex">
		<div class="tm-flex-1 all-height">
			{if condition="$uinfo.roleid == '9'"}
			<a href="{:url('member/shensujiemian', ['clientid'=>$info.id,'token'=>$token, 'timestamp'=>time()])}" class="mui-btn mui-btn-orange href">申诉</a>
			{/if}
		</div>
	</div>
</div>
<div class="mui-content">
	<div class="main-tab-con">
		<!--切换1-->
		<div id="item100" class="mui-control-content mui-active">
			<div class="tm-df-size">
				<ul class="mui-table-view max">
					<li class="mui-table-view-cell">
						<div class="tm-cell-pad">
							<div class="tm-flex">
								<div class="tm-6em tm-flex-head">
									<span class="tm-font-gray">客户状态</span>
								</div>
								<div class="tm-flex-1">
									<div class="tm-font-boldx mui-ellipsis">{:config('CLIENT_TYPE.'.$info.typeid)}</div>
								</div>
							</div>
						</div>
					</li>
					<li class="mui-table-view-cell">
						<div class="tm-cell-pad">
							<div class="tm-flex">
								<div class="tm-6em tm-flex-head">
									<span class="tm-font-gray">获得时间</span>
								</div>
								<div class="tm-flex-1">
									<div class="tm-font-boldx mui-ellipsis">{$info.getdate}</div>
								</div>
							</div>
						</div>
					</li>
					<li class="mui-table-view-cell">
						<div class="tm-cell-pad">
							<div class="tm-flex">
								<div class="tm-6em tm-flex-head">
									<span class="tm-font-gray">客户名称</span>
								</div>
								<div class="tm-flex-1">
									<div class="tm-font-boldx mui-ellipsis">{$info.name}</div>
								</div>
							</div>
						</div>
					</li>
					<li class="mui-table-view-cell">
						<div class="tm-cell-pad">
							<div class="tm-flex">
								<div class="tm-6em tm-flex-head">
									<span class="tm-font-gray">线索分类</span>
								</div>
								<div class="tm-flex-1">
									<div class="tm-font-boldx mui-ellipsis">{:config('CLIENT_KIND.'.$info.kind)}</div>
								</div>
							</div>
						</div>
					</li>
					{eq name="info.kind" value="gouche"}
					<li class="mui-table-view-cell">
						<div class="tm-cell-pad">
							<div class="tm-flex">
								<div class="tm-6em tm-flex-head">
									<span class="tm-font-gray">意向产品</span>
								</div>
								<div class="tm-flex-1">
									<div class="tm-font-boldx mui-ellipsis">{$info.product}</div>
								</div>
							</div>
						</div>
					</li>
					{/eq}
					<li class="mui-table-view-cell">
						<div class="tm-cell-pad">
							<div class="tm-flex">
								<div class="tm-6em tm-flex-head">
									<span class="tm-font-gray">联系电话</span>
								</div>
								<div class="tm-flex-1">
									<div class="tm-font-boldx mui-ellipsis">{$info.phone}</div>
								</div>
							</div>
						</div>
					</li>
					<!-- <li class="mui-table-view-cell">
						<div class="tm-cell-pad">
							<div class="tm-flex">
								<div class="tm-6em tm-flex-head">
									<span class="tm-font-gray">社交账号</span>
								</div>
								<div class="tm-flex-1">
									<div class="tm-font-boldx mui-ellipsis">{$info.qq}</div>
								</div>
							</div>
						</div>
					</li> -->
					<li class="mui-table-view-cell">
						<div class="tm-cell-pad">
							<div class="tm-flex">
								<div class="tm-6em tm-flex-head">
									<span class="tm-font-gray">地址</span>
								</div>
								<div class="tm-flex-1">
									<div class="tm-font-boldx mui-ellipsis">{$info.home}</div>
								</div>
							</div>
						</div>
					</li>
					<li class="mui-table-view-cell">
						<div class="tm-cell-pad">
							<div class="tm-flex">
								<div class="tm-6em tm-flex-head">
									<span class="tm-font-gray">客户级别</span>
								</div>
								<div class="tm-flex-1">
									<div class="tm-font-boldx mui-ellipsis">{:config('CLIENT_SKILLED.'.$info.skilled)}</div>
								</div>
							</div>
						</div>
					</li>
					<li class="mui-table-view-cell">
						<div class="tm-cell-pad">
							<div class="tm-flex">
								<div class="tm-6em tm-flex-head">
									<span class="tm-font-gray">销售姓名</span>
								</div>
								<div class="tm-flex-1">
									<div class="tm-font-boldx mui-ellipsis">{$info.marketer}</div>
								</div>
							</div>
						</div>
					</li>
					<li class="mui-table-view-cell">
						<div class="tm-cell-pad">
							<div class="tm-flex">
								<div class="tm-6em tm-flex-head">
									<span class="tm-font-gray">备注</span>
								</div>
								<div class="tm-flex-1">
									<div class="tm-font-boldx mui-ellipsis">{$info.remark}</div>
								</div>
							</div>
						</div>
					</li>
				</ul>
			</div>
		</div>
		<!--切换1 end-->

		<!--切换2-->
		<div id="item200" class="mui-control-content">
			<div class="indent-cell tm-df-size">
				{volist name=":get_model_func('OrderClient', 'list_data', ['clientid'=>$info.id, 'isdel'=>0])" id="v"}
				<div class="indent-card">
					<div class="mui-table-view max">
						<div class="mui-table-view-cell">
							<div class="tm-flex flex-align-center">
								<div class="tm-flex-1">
									<div class="tm-flex flex-align-center">
										<div class="tm-atav tm-flex-head">
											<div class="tm-location-parent">
												<div class="tm-location-img" style="background-image: url({$v.uinfo.avatar});"></div>
												<img class="redundant-img" src="{$images_path}px-1.png" alt="" width="100">
											</div>
										</div>
										<div>
											<span class="tm-font-bold">{$v.uinfo.realname}</span>
										</div>
									</div>
								</div>
								<div>
									<span class="tm-font-gray">{$v.sucdate}</span>
								</div>
							</div>
						</div>
						<a class="href" href="{:url('order', ['id'=>$v.id, 'token'=>$token, 'timestamp'=>time()])}">
							<div class="mui-table-view-cell">
								<div class="tm-flex flex-align-center goods-item">
									<div class="tm-flex-1">
										<div class="tm-flex flex-align-center">
											<div class="tm-atav tm-flex-head">
												<div class="tm-location-parent">
													{volist name=":get_model_func('Cartype', 'list_data', ['id'=>$v.cartypeid2])" id="carinfo"}
													<div class="tm-location-img" style="background-image: url({$carinfo.thumb});"></div>
													<img class="redundant-img" src="{$images_path}px-3-4.png" alt="" width="100">
													{/volist}
												</div>
											</div>
											<div>
												<span class="tm-font-bold">{$v.product}</span>
											</div>
										</div>
									</div>
								</div>
							</div>
						</a>
					</div>
					<div class="tm-label tm-bg-white">
						<div class="main-content">
							<div class="tm-font-bold">
								<span class="tm-font-green tm-lg-size">¥{$v.totalprice}</span>
							</div>
						</div>
					</div>
				</div>
				{/volist}
			</div>
		</div>
		<div id="item300" class="mui-control-content">
			<div class="possessor-cell">
				<ul class="mui-table-view max">
					<li class="mui-table-view-cell">
						<div class="tm-flex flex-align-center">
							<a href="" class="tm-flex-1">
								<div class="tm-flex flex-align-center">
									<div class="tm-atav tm-flex-head">
										<div class="tm-location-parent">
											<div class="tm-location-img" style="background-image: url({$info.uinfo.avatar});"></div>
											<img class="redundant-img" src="{$images_path}px-1.png" alt="" width="100">
										</div>
									</div>
									<div class="tm-label-no">
										<span class="tm-df-size tm-font-boldx">{$info.uinfo.realname}</span>
									</div>
								</div>
							</a>
							<div class="">
								<div class="tm-flex">
									<div class="tm-cell-operation-group tm-icon-item">
										<a href="tel:{$info.uinfo.phone}" class="tm-icon tm-icon-btn href">
											<img src="{$images_path}phone.png" alt="" width="15" height="15" z/>
										</a>
										<a href="sms:{$info.uinfo.phone}" class="tm-icon tm-icon-btn href">
											<img src="{$images_path}weixin-gray.png" alt="" width="15" height="15" />
										</a>
									</div>
								</div>
							</div>
						</div>
					</li>
				</ul>
			</div>
		</div>
	</div>
</div>
<div class="main-layer-group" id="main-layer-group">
	<div class="mask" id="main-mask">
	</div>
	<div class="content-list no" style="margin-top: -40px;">
		<div class="show-operation-btns tm-bg-white">
			<div class="uk-text-center tm-df-size">
				<!-- <a href="Javascript:" class="operation-btn-item tm-block appshare" sharedata="{ shareurl:'{:APP_URL.'/index/news/bus_card/clientid/'.$info.id}', sharetitle:'{$info.name} 的名片', sharedesc:'意向产品 {$info.product}', sharethumb:'{:APP_URL.thumb($info.car_thumb, 80, 80)}'}" coco-callback="suc_share"> -->
				<!-- <a href="Javascript:" class="operation-btn-item tm-block" open-type="share">'{:APP_URL.'/index/news/bus_card/clientid/'.$info.id}'
					分享
				</a> -->
				{if condition="$uinfo.roleid == 8"}
				<a href="{:url('order_add', ['clientid'=>$info.id,'token'=>$token,'timestamp'=>time()])}" class="operation-btn-item tm-block href">
					录订单
				</a>
				<a href="{:url('clue_edit', ['clientid'=>$info.id,'token'=>$token,'timestamp'=>time()])}" class="operation-btn-item tm-block href">
					编辑
				</a>
				{/if}
				<a href="javascript:;" id="open-layer" class="operation-btn-item tm-block">
					删除
				</a>
			</div>
		</div>
	</div>
</div>
<!--layer-->
<div id="layer" style="display: none;">
	<form id="formid" method="post">
	<div class="tm-layer-header tm-default-size tm-font-default">
		<div class="tm-label-lg">
			<div class="main-content">
				<div class="tm-inline-1-5 tm-df-size tm-font-bold">
					删除后不可恢复，且与客户的所有资料将一起删除
				</div>
			</div>
		</div>
	</div>
	<div class="tm-layer-body">
		<div class="main-content">
			<input type="password" class="tm-small-input" name="password" value="" placeholder="输入登录密码确认" />
		</div>
	</div>
	<input type="hidden" name="id" value="{$info.id}">
	<div class="tm-layer-footer">
		<div class="tm-label-lg">
			<div class="main-content-md">
				<div class="to-btn-group">
					<ul class="uk-grid">
						<li class="uk-width-1-2">
							<button id="close-layer" type="button" class="mui-btn mui-btn-block">取消</button>
						</li>
						<li class="uk-width-1-2">
							<button type="button" class="mui-btn mui-btn-green mui-btn-block cocoPostFormAjax" formid="formid" ajaxurl="{:url('v2/client/del_client')}" ajax-callback="suc_del">确定</button>
						</li>
					</ul>
				</div>
			</div>
		</div>
	</div>
	</form>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
<script type="text/javascript">
	function suc_del(obj, data) {
		coco_msg('删除成功');
		setTimeout(function() {
			wx.miniProgram.navigateBack();
		}, 500);
	}
	function suc_share(obj, data) {
		coco_msg('分享成功');
		return false;
	}
	$(document).ready(function() {
		var datajson = {};
		datajson.title = '{$info.name}';
		var dataurl = {};
		// dataurl.url = encodeURIComponent('https://sijia.test.cmsthink.com/index/news/bus_card/clientid/258');
		datajson.path = 'https://sijia.test.cmsthink.com/index/news/bus_card/clientid/{$info.id}';
		datajson.typeid = '';
		console.dir(datajson);
		wx.miniProgram.postMessage({
		    data: datajson
		});
	});
</script>
<script type="text/javascript">
	var closeAll = function(){
		$("#main-layer-group").removeClass("active");
	}
	var openAll = function(){
		$("#main-layer-group").addClass("active");
	}
	
	mui.ready(function(){
		mui(document).on("tap","#main-mask",function(){
			closeAll();
		})
		
		mui(document).on("tap","#open-operation",function(){
			openAll();
		})
	})
</script>
<script type="text/javascript">
	mui(document).on('tap', "#open-layer", function() {
		layer.open({
			type: 1,
			title: false,
			closeBtn: 0,
			skin: 'tm-page-layer',
			shade: 0.5,
			shadeClose: true,
			content: $('#layer')
		});
	})
	//关闭
	mui(document).on("tap", "#close-layer", function() {
		layer.closeAll();
	})
</script>
{/block}